# Contributor: Mark Hills <mark@xwax.org>
# Maintainer: Mark Hills <mark@xwax.org>
pkgname=cronie
pkgver=1.7.0
pkgrel=0
pkgdesc="The standard UNIX daemon crond that runs specified programs at scheduled times"
url="https://github.com/cronie-crond/cronie"
arch="all"
license="ISC"
install="$pkgname-openrc.post-install"
makedepends="musl-obstack-dev"
options="suid !check" # No testsuite
subpackages="$pkgname-doc $pkgname-openrc"
source="
	https://github.com/cronie-crond/cronie/releases/download/cronie-$pkgver/cronie-$pkgver.tar.gz
	cronie.initd
	cronie.confd
	"

build() {
	export LIBS="-lobstack"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--mandir=/usr/share/man \
		--without-pam \
		--without-selinux \
		--with-inotify \
		SPOOL_DIR=/etc/crontabs
	make
}

package() {
	make install DESTDIR="$pkgdir"

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname

	mkdir "$pkgdir"/etc/cron.d

	# Ordinary users access to edit content of the crontabs directory
	chmod 6755 "$pkgdir"/usr/bin/crontab

	# Default is all users can access cron
	touch "$pkgdir"/etc/cron.deny
}

sha512sums="
a8e6688a164540e2cd3741c58813b6684c4c22a04806bcc8ba028a9ff72f986f165715ac3663bd34133af6566bdbd272a3e7be893f139e315aef35b2dbeb622f  cronie-1.7.0.tar.gz
ea0795420bc2a9c770c2950c066dc19655056c9e4e6d7277d5deade5144b988f2df806fe025a8fce67fe9bab73a25332f141395c222f2d2a62a41a874ce98dc8  cronie.initd
caabbeb35c8bfed5f139063416cb6667ab066918e8ef57b057bf4d7bbb005ad6cc5d34687e52ed22f8152e61f4c35709e895652497600a7194cdfb04d48ca152  cronie.confd
"
